# Maintainer: Jan Alexander Steffens (heftig) <heftig@archlinux.org>
# Contributor: Jan de Groot <jgc@archlinux.org>

pkgname=librsvg
pkgver=2.52.0
pkgrel=1
epoch=2
pkgdesc="SVG rendering library"
url="https://wiki.gnome.org/Projects/LibRsvg"
arch=(x86_64)
license=(LGPL)
depends=(gdk-pixbuf2 pango)
makedepends=(gobject-introspection vala gtk-doc git rust)
provides=(librsvg-${pkgver%%.*}.so)
_commit=1729feb4c197a7dd94fe303931d51eb843bdcaf9  # tags/2.52.0^0
source=("git+https://gitlab.gnome.org/GNOME/librsvg.git#commit=$_commit")
sha256sums=('SKIP')

pkgver() {
  cd librsvg
  git describe --tags | sed 's/-/+/g'
}

prepare() {
  cd librsvg
  NOCONFIGURE=1 ./autogen.sh
}

# Use LTO
export CARGO_PROFILE_RELEASE_LTO=true CARGO_PROFILE_RELEASE_CODEGEN_UNITS=1

build() {
  cd librsvg
  ./configure --prefix=/usr --disable-static --enable-vala \
    --enable-gtk-doc
  sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0 /g' libtool
  make
}

check() {
  cd librsvg
  # Test suite is very dependent on the versions of
  # Cairo, Pango, FreeType and HarfBuzz
  make check || :
}

package() {
  cd librsvg
  make DESTDIR="$pkgdir" install
}

# vim:set sw=2 et:
